package com.spc.car.core.framework.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 * 
 * @author
 */
@Data
@Component
@ConfigurationProperties(prefix = "app")
public class AppConfig
{
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

    private String env;
    /** 版权年份 */
    private String copyrightYear;

    /** 实例演示开关 */
    private boolean demoEnabled;

    /** 上传路径 */
    private String profile;

    /** 获取地址开关 */
    private boolean addressEnabled;

    /**
     * 获取头像上传路径
     */
    public String getAvatarPath()
    {
        return this.profile + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public String getDownloadPath()
    {
        return this.profile + "/download/";
    }

    /**
     * 获取上传路径
     */
    public String getUploadPath()
    {
        return this.profile + "/upload";
    }

    public boolean isPrd() {
        return "prd".equals(this.env);
    }
}